import request from "@/utils/request";

// 查询公告列表
export function listNotice(query) {
  return request({
    url: "/system/notice/list",
    method: "get",
    params: query,
  });
}

// 查询公告详细
export function getNotice(noticeId) {
  return request({
    url: "/system/notice/" + noticeId,
    method: "get",
  });
}

// 新增公告
export function addNotice(data) {
  return request({
    url: "/system/notice",
    method: "post",
    data: data,
  });
}

// 修改公告
export function updateNotice(data) {
  return request({
    url: "/system/notice",
    method: "put",
    data: data,
  });
}

// 删除公告
export function delNotice(noticeId) {
  return request({
    url: "/system/notice/" + noticeId,
    method: "delete",
  });
}

// 新公告接口列表
// /admin/notice/page
export function getNoticeList(params) {
  return request({
    url: "/admin/notice/page",
    method: "get",
    params,
  });
}
// 获取详情
// /admin/notice/detail
export function getNoticeDetail(id) {
  return request({
    url: "/admin/notice/detail",
    method: "get",
    params: { id },
  });
}
// 新增公告
// /admin/notice/save
export function saveNotice(data) {
  return request({
    url: "/admin/notice/save",
    method: "post",
    data,
  });
}
// 修改公告
// /admin/notice/update
export function updateNoticeV2(data) {
  return request({
    url: "/admin/notice/update",
    method: "post",
    data,
  });
}
// 删除公告
// /admin/notice/remove
export function removeNotice(id) {
  return request({
    url: "/admin/notice/remove",
    method: "post",
    params: { id },
  });
}
